<?php
session_start();
$captcha = $_SESSION['6_letters_code'];

if(isset($_POST['email']) && isset($_POST['6_letters_code'])) {
     
    // EDIT THE 2 LINES BELOW AS REQUIRED
    $email_to = "iletisim@gevezecafe.com";
    $email_subject = "İletişim Formu";
	$error_message = '';
    
     
    function died($error) {
        // your error code can go here
        echo $error;
        die();
    }
     
    // validation expected data exists
    if(
        !isset($_POST['email']) ||
        !isset($_POST['name']) ||
        !isset($_POST['comments'])) {
        died('Üzgünüz, hata olustu.');      
    }
    if($_POST['6_letters_code'] != $captcha) {
    	$error_message = 'Tekrar Deneyin';
    }
     
    $name = $_POST['name']; // required
    $email_from = $_POST['email']; // required
    $comments = $_POST['comments']; // required
     

  if(strlen($comments) < 2) {
    $error_message = 'Lütfen mesajınızı giriniz.<br />';
  }
  if(strlen($error_message) > 0) {
    died($error_message);
  }
     
    function clean_string($string) {
      $bad = array("content-type","bcc:","to:","cc:","href");
      return str_replace($bad,"",$string);
    }
    
	$email_message = "Gönderen İsmi:".clean_string($name)."\n"; 
    $email_message .= "Email Adresi : ".clean_string($email_from)."\n";
    $email_message .= "Mesajı: ".clean_string($comments)."\n";
     
     
// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers); 
?>
          Teşekkürler...

          En kısa zamanda dönüş yapacağız.
<?php
}
else
	echo "bye";
?>